package com.seteam.collabcrossword.windows;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class StartGame extends JFrame {
    private final Logger logger = LoggerFactory.getLogger(StartGame.class);
    private Container container;
    private JButton startButton;
    private JLabel label;

    public StartGame() {
        super("Start Game");
        init();
    }

    private void init() {
        startButton = new JButton("START");
        startButton.setFont(new Font("Arial", Font.BOLD, 18));
        container = getContentPane();
        container.setLayout(new FlowLayout(FlowLayout.CENTER));

        container.add(startButton);

        startButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(final ActionEvent actionEvent) {
                if (actionEvent.getSource() == startButton) {
                    logger.info("Starting game");
                    setVisible(false);
                    //ProgressWindow progressWindow = new ProgressWindow();
                    Game game = new Game();
                }
            }
        });

        setSize(640, 480);
        setVisible(true);
    }
}
